package com.xj.api;

import cn.hutool.extra.spring.SpringUtil;
import com.tfswx.Class1;
import com.th.Class2;
import com.xj.JarTestApp;
import com.xj.aop.AopTest;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author ricky
 * @date 2022/4/29 16:32
 */
@Api(tags = "测试接口")
@RestController
@RequestMapping("/")
public class TestController {

    @ApiOperation("测试接口")
    @GetMapping("/test")
    public String hello() {
        if ("0".equals(JarTestApp.lx)) {
            Class1.test();
        } else if ("1".equals(JarTestApp.lx)) {
            Class2.csff();
        }
        return "hello world";
    }

    @ApiOperation("注册AOP")
    @GetMapping("/aop")
    public String aop() {

        Class<AopTest> aopTestClass = AopTest.class;
        String name = aopTestClass.getName();
        SpringUtil.registerBean(name, aopTestClass);
        return "hello world";
    }
}
